<template>
	<view class="switch_iden">
		<!-- #ifdef APP-PLUS -->
		<top-set></top-set>
		<tab-top title="身份切换" ></tab-top>
		<!-- #endif -->
		<view class="box">
			<view class="iden_img">
				<image class="user_iden_img" :src="identity==1?'/static/identity/cleaner_img.png':'/static/identity/hotel_img.png'" mode=""></image>
				
			</view>
			<view class="cur_iden">
				您的当前身份
			</view>
			<view class="user_iden">
				{{identity==1?'保洁员':'酒店管理'}}
			</view>
			<view class="uni-padding-wrap uni-common-mt">
				<button type="primary" @tap="conIden()">切换为{{identity == 1?'酒店管理':'保洁员'}}</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		
		data() {
			return {
				identity:uni.getStorageSync('user_info').type
			}
		},
		methods: {
			conIden(){
				if(this.identity){
					let identity = this.identity == 1 ? '2' : '1';
					this.termTypeUpdate(identity)
					uni.navigateBack({
						delta: 10,
						animationType: this.GLOBAL.backAnimation,
						animationDuration: this.GLOBAL.animationTime
					});
					return;
				}
				// let identity = this.identity==1?'2':'1';
				// this.req({
				// 	url:'user/editAccountType',
				// 	data:{
				// 		id:this.isLogin().id,
				// 		type:identity
				// 	}
				// },
				// (res)=>{
				// 	if(res.data.status == 1){
				// 		this.termTypeUpdate(identity)
				// 		uni.navigateBack({
				// 			delta: 10,
				// 			animationType: this.GLOBAL.backAnimation,
				// 			animationDuration: this.GLOBAL.animationTime
				// 		});
				// 	}else{
				// 		uni.showToast({
				// 			title: res.data.message
				// 		});
				// 		
				// 	}
				// },
				// (res)=>{
				// 	
				// })
				
			}
		},
		mounted(){
			
		},
		computed:{
			
		}
	}
</script>

<style lang="scss">
	.switch_iden{
		.box{
			margin: 0 auto;
			margin-top: 160upx;
			width: 317upx;
			height: 451upx;
			text-align: center;
			.iden_img{
				width: 317upx;
				height: 347upx;
				.user_iden_img{
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
				
			}
			.cur_iden{
				margin-top: 34upx;
				line-height: 1;
				font-size: 24upx;
				color: #999999;
			}
			.user_iden{
				margin-top: 19upx;
				color: #333333;
				line-height: 1;
				font-size: 32upx;
				
			}
			.uni-common-mt{
				position: fixed;
				width: 540upx;
				left:0;
				right: 0;
				margin:  0 auto;
				bottom: 45upx;
				button{
					background: #3595F9 !important;
				}
			}
		}
	}
	
</style>
